/*
============================================================================
 Name        : $(Classname).cpp
 Author      : $(Author)
 Version     :
 Copyright   : $(Copyright)
 Description : C$(Classname) implementation
============================================================================
*/

#include "$(Classname).h"

C$(Classname)::C$(Classname)() : CActive(EPriorityStandard)	// Standard priority
{
}

void C$(Classname)::ConstructL()
{
	User::LeaveIfError(iTimer.CreateLocal());	// Initialize timer
	CActiveScheduler::Add(this);				// Add to scheduler
}

C$(Classname)::~C$(Classname)()
{
	Cancel(); // Cancel any request, if outstanding
	// Delete instance variables if any
}

void C$(Classname)::DoCancel()
{
	iTimer.Cancel();
}

void C$(Classname)::Start(TTimeIntervalMicroSeconds32 aDelay)
{
	Cancel();						// Cancel any request, just to be sure
	iState = EUninitialized;
	iTimer.After(iStatus, aDelay);	// Set for later
	SetActive();					// Tell scheduler a request is active
}

void C$(Classname)::RunL()
{
	if (iState == EUninitialized) {
		// Do something the first time RunL() is called
		iState = EInitialized;
	} else if (iState != EError) {
		// Do something
	}
	iTimer.After(iStatus, 1000000);	// Set for 1 sec later
	SetActive();					// Tell scheduler a request is active
}
